<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script >
       // alert("你好！")
      var str=""
     //语法
      for(var i=1;i<=9;i++)
      {
         for(var j=1;j<i;j++)
         {
            str = str + j +"*" +i +"=" +j*i + " " 
         }
         str +="\n"
      }
      console.log(str);
      var a = 1
      var b = 2
      var temp
      temp =a
      a=b
      b=temp

      console.log("a=" +a );
      console.log("b=" +b );

      //数组 算法
      var arr= [53,45,12,78,2,89]
      
      for(var j=1;j<arr.length;j++)
      {
        for(var i=0;i<arr.length-j;i++)
        {
            if(arr[i]<arr[i+1]){
                temp = arr[i]
                arr[i] =arr[i+1]
                arr[i+1] =temp
            }
        }
    }

      console.log(arr);
    //函数
    function MaoPao(tempArr)
    {
        for(var j=1;j<tempArr.length;j++)
        {
            for(var i=0;i<tempArr.length-j;i++)
            {
                if(tempArr[i]<tempArr[i+1]){
                    temp = tempArr[i]
                    tempArr[i] =tempArr[i+1]
                    tempArr[i+1] =temp
                }
            }
        }  
    }
    var arr1 =[23,34,56,5,21,78]
    var arr21 =[123,34,56,5,21,78]

    MaoPao(arr1)
    console.log(arr1);
     
    
      


    </script>
</body>
</html>